package com.xiaoshuidi.cloud.module.rooms.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xiaoshuidi.cloud.module.rooms.controller.admin.roomdevice.vo.MeterReadingVO;
import com.xiaoshuidi.cloud.module.rooms.controller.admin.roomdevice.vo.PayModeMappingVo;
import com.xiaoshuidi.cloud.module.rooms.pojo.RoomSdiotPayModeMapping;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface RoomSdiotPayModeMappingMapper extends BaseMapper<RoomSdiotPayModeMapping> {
    MeterReadingVO findMeterReadingVO(@Param("roomHouseId")Long roomHouseId,@Param("feeType")String feeType,@Param("payMode")String payMode);

    List<MeterReadingVO> findRoomName(@Param("roomHouseId")Long roomHouseId);

    MeterReadingVO getModeMappingByRoomId(@Param("roomHouseId")Long roomHouseId,@Param("feeType")String feeType);

    @Select("select rsdpa.*,rh.apartment_id apartmentId from room_sdiot_pay_mode_mapping rsdpa left join room_house rh on rsdpa.room_house_id=rh.id " +
            "where ${ew.sqlSegment}")
    List<PayModeMappingVo> getPayModeMappingList(@Param("ew") QueryWrapper<?> wrapper);

    void updatePayModeMapping(@Param("apartmentId")Long apartmentId,@Param("payModeConfigId")Long payModeConfigId);
}
